/*  1:   */ package com.atomikos.datasource.xa.session;
/*  2:   */ 
/*  3:   */ import com.atomikos.datasource.xa.XAResourceTransaction;
/*  4:   */ import com.atomikos.datasource.xa.XATransactionalResource;
/*  5:   */ import com.atomikos.icatch.CompositeTransaction;
/*  6:   */ import com.atomikos.icatch.HeuristicMessage;
/*  7:   */ import com.atomikos.icatch.system.Configuration;
/*  8:   */ import javax.transaction.xa.XAResource;
/*  9:   */ 
/* 10:   */ class BranchSuspendedStateHandler
/* 11:   */   extends TransactionContextStateHandler
/* 12:   */ {
/* 13:   */   private XAResourceTransaction branch;
/* 14:   */   private CompositeTransaction ct;
/* 15:   */   
/* 16:   */   BranchSuspendedStateHandler(XATransactionalResource resource, XAResourceTransaction branch, CompositeTransaction ct, XAResource xaResource)
/* 17:   */   {
/* 18:43 */     super(resource, xaResource);
/* 19:44 */     this.branch = branch;
/* 20:45 */     this.ct = ct;
/* 21:   */   }
/* 22:   */   
/* 23:   */   TransactionContextStateHandler checkEnlistBeforeUse(CompositeTransaction ct, HeuristicMessage hmsg)
/* 24:   */     throws InvalidSessionHandleStateException, UnexpectedTransactionContextException
/* 25:   */   {
/* 26:52 */     String msg = "Detected illegal attempt to use a suspended XA session";
/* 27:53 */     Configuration.logWarning(msg);
/* 28:54 */     throw new InvalidSessionHandleStateException(msg);
/* 29:   */   }
/* 30:   */   
/* 31:   */   TransactionContextStateHandler sessionClosed()
/* 32:   */   {
/* 33:59 */     return new BranchEndedStateHandler(getXATransactionalResource(), this.branch, this.ct);
/* 34:   */   }
/* 35:   */   
/* 36:   */   TransactionContextStateHandler transactionTerminated(CompositeTransaction tx)
/* 37:   */   {
/* 38:64 */     TransactionContextStateHandler ret = null;
/* 39:65 */     if (this.ct.isSameTransaction(tx)) {
/* 40:65 */       ret = new NotInBranchStateHandler(getXATransactionalResource(), getXAResource());
/* 41:   */     }
/* 42:66 */     return ret;
/* 43:   */   }
/* 44:   */   
/* 45:   */   boolean isSuspendedInTransaction(CompositeTransaction tx)
/* 46:   */   {
/* 47:71 */     boolean ret = false;
/* 48:72 */     if ((tx != null) && (this.ct.isSameTransaction(tx))) {
/* 49:72 */       ret = true;
/* 50:   */     }
/* 51:73 */     return ret;
/* 52:   */   }
/* 53:   */   
/* 54:   */   public TransactionContextStateHandler transactionResumed()
/* 55:   */     throws InvalidSessionHandleStateException
/* 56:   */   {
/* 57:78 */     return new BranchEnlistedStateHandler(getXATransactionalResource(), this.ct, getXAResource(), this.branch);
/* 58:   */   }
/* 59:   */ }


/* Location:           C:\myfile\mysoft\apache-maven-3.5.0-bin\apache-maven-3.5.0\myrep\com\atomikos\transactions-jta\3.7.0\transactions-jta-3.7.0.jar
 * Qualified Name:     com.atomikos.datasource.xa.session.BranchSuspendedStateHandler
 * JD-Core Version:    0.7.0.1
 */